using System;
using System.Collections.Generic;
using System.Linq;

public class PriceUpdateItem
{
    public string Id { get; set; }
    public string UnitPriceStr { get; set; }
}

public class PriceUpdateResponse
{
    public List<string> ErrorMessages { get; set; }

    public PriceUpdateResponse()
    {
        ErrorMessages = new List<string>();
    }
}

public class SupplierService
{
    private List<SupplierItem> _shpolist = new List<SupplierItem>();

    // 模拟商品数据
    public SupplierService()
    {
        _shpolist.Add(new SupplierItem { Id = "96", Name = "商品A", UnitPriceStr = "50" });
        _shpolist.Add(new SupplierItem { Id = "74", Name = "商品B", UnitPriceStr = "50" });
        _shpolist.Add(new SupplierItem { Id = "100", Name = "商品C", UnitPriceStr = "50" });
    }

    public PriceUpdateResponse UpdatePrices(List<PriceUpdateItem> itemList)
    {
        var response = new PriceUpdateResponse();

        foreach (var item in itemList)
        {
            try
            {
                var existingItem = _shpolist.FirstOrDefault(i => i.Id == item.Id);
                if (existingItem != null)
                {
                    existingItem.UnitPriceStr = item.UnitPriceStr;
                }
                else
                {
                    response.ErrorMessages.Add($"Item with Id {item.Id} not found.");
                }
            }
            catch (Exception ex)
            {
                response.ErrorMessages.Add($"Error updating price for item with Id {item.Id}: {ex.Message}");
            }
        }

        return response;
    }
}

public class SupplierItem
{
    public string Id { get; set; }
    public string Name { get; set; }
    public string UnitPriceStr { get; set; }
}